import { defineConfig } from 'vitepress';
import pkg from '../../package.json';
import navigation from './navigation.json';

export default defineConfig({
  title: 'MK知识库',
  description: '一个Javascript工具库和知识库',

  head: [
    ['link', { rel: 'icon', href: './static/site-icon.png' }],
    ['script', { type: "text/javascript", src: 'https://cpython666.github.io/js/clickjs/fireworks.js' }],
    ['script', { type: "text/javascript", src: 'https://cpython666.github.io/js/clickjs/anime.min.js' }]
  ],
  metaChunk: true,
  base: '/',
  appearance: true,
  markdown: {
    lineNumbers: true,
    theme: { light: 'github-light', dark: 'github-dark' },

  },
  locales: {
    root: {
      label: '简体中文',
      lang: 'zh',
      dir: '/',
      title: '✏️MK知识库',
      description: '一个Javascript工具库和知识库',
    }
  },
  lastUpdated: true,
  themeConfig: {
    sidebar: { '/src/': navigation },
    outline: {
      level: [2, 4],
      label: '本页目录'
    },
    footer: {
      message: 'Released under the MIT License.',
      copyright: 'Copyright © 2023-present hacxy',

    },
    nav: [
      {
        text: '首页',
        link: '/index'
      },
      {
        text: '前端',
        items: [
          { text: 'Vue', link: '/VueItems', activeMatch: '/VueItems' },
          { text: 'React', link: '/React-items', activeMatch: '/React-items' },
        ]
      },
      {
        text: '后端',
        items: [
          { text: 'Item A', link: '/item-1' },
          { text: 'Item B', link: '/item-2' },
          { text: 'Item C', link: '/item-3' }
        ]
      },
      {
        text: '运维',
        items: [
          { text: 'Item A', link: '/item-1' },
          { text: 'Item B', link: '/item-2' },
          { text: 'Item C', link: '/item-3' }
        ]
      },
      {
        text: `🔰-${pkg.version}`,
        items: [{ text: '更新日志', link: '/CHANGELOG', activeMatch: '/CHANGELOG' }],
      },
    ],
    socialLinks: [
      {
        icon: 'github',
        link: 'https://github.com/Misyan-03'
      },
      {
        icon: {
          svg: '<svg t="1713438097287" class="icon" viewBox="0 0 1121 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5239" width="48" height="48"><path d="M1108.01815019 152.23370838l-89.72681904-4.89068759S984.35530601 25.85425236 828.60518734 14.95438794C672.85605155 4.05747208 570.94772487 10.89912728 570.94772487 10.89912728s115.53266578 75.04689342 69.23232192 208.96190045c-34.40189852 72.22708179-88.82848936 131.24065795-146.85822745 199.06356549l-383.7165077 446.83547013c357.19612521-5.34378385 567.78465104-8.01715006 631.76852607-8.01715006 179.43398097 0 331.07773051-158.77731274 324.87296549-335.43767627-4.26657452-121.41308858-42.14974625-148.84556072-55.1715951-202.01999401-13.01693457-53.17541615 13.04248882-137.97419909 96.94294209-168.05153463z" fill="#31CC79" p-id="5240"></path><path d="M491.75514811 420.36840754C303.9413435 636.79804197 8.77812571 981.15119797 8.77812571 981.15119797c531.00326003 142.20833939 775.65656505-202.93110079 813.9672788-322.41582742 51.36204825-160.1985214-21.21001572-238.36892872-62.2835355-263.86222751-139.26272229-86.43818547-242.58930905-4.60369387-268.7067209 25.49329879z" fill="#93E65C" p-id="5241"></path><path d="M494.36266302 415.3735373c29.79329038-32.14919435 131.07848684-106.92875115 266.17881727-22.74130417 41.07745119 25.59355001 113.65344659 104.07945386 62.28746691 264.931574-14.88042808 46.60502898-60.9026239 127.39474547-142.75284119 200.40712857-84.8744628 0.58283314-275.36654789 3.09009681-571.48510096 7.53161958L474.61218731 438.31730962a8405.73366256 8405.73366256 0 0 1 18.93470588-22.06215119z" fill="#60DB69" p-id="5242"></path></svg>'
        },
        link: 'https://www.yuque.com/xianghua-iouqs'
      },
      {
        icon: {
          svg: '<svg t="1713438286966" class="icon" viewBox="0 0 1316 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8503" width="32" height="32"><path d="M643.181714 247.698286l154.916572-123.172572L643.181714 0.256 643.072 0l-154.660571 124.269714 154.660571 123.245715 0.109714 0.182857z m0 388.461714h0.109715l399.579428-315.245714-108.361143-87.04-291.218285 229.888h-0.146286l-0.109714 0.146285L351.817143 234.093714l-108.251429 87.04 399.433143 315.136 0.146286-0.146285z m-0.146285 215.552l0.146285-0.146286 534.893715-422.034285 108.397714 87.04-243.309714 192L643.145143 1024 10.422857 525.056 0 516.754286l108.251429-86.893715L643.035429 851.748571z" fill="#1E80FF" p-id="8504"></path></svg>'
        },
        link: 'https://juejin.cn/user/2412761349109661/posts'
      },
      //CSDN
      // {
      //   icon: {
      //    svg:'<svg t="1713438760421" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5102" width="32" height="32"><path d="M512.010445 0.000585A512.281535 512.281535 0 0 0 1.016196 479.339287c-19.250785 305.964609 237.679908 562.895302 543.644517 543.644517A511.98897 511.98897 0 0 0 512.010445 0.000585z" fill="#ED5F48" p-id="5103"></path><path d="M520.787399 600.870841q4.037399-37.389823 8.074797-73.726412 5.03212-49.502019 9.069519-98.009317a30.602312 30.602312 0 0 1 2.047956-5.851303c0.643643-1.3458 2.691599-2.047956 5.851303-2.047956 17.553908-1.3458 35.107815-1.989443 52.661722-1.989442a259.56378 259.56378 0 0 1 51.491462 5.03212 145.463381 145.463381 0 0 1 35.107816 12.112196 74.136003 74.136003 0 0 1 26.272348 24.224392 86.189686 86.189686 0 0 1 11.117475 64.364328 94.440023 94.440023 0 0 1-35.107816 57.576817 123.40397 123.40397 0 0 1-31.304468 15.154873 230.131728 230.131728 0 0 1-32.357703 5.851303 484.019744 484.019744 0 0 1-102.924411-2.691599z m53.539418-32.357703c9.420597 0 18.139038 0 26.213835-0.994722a94.205971 94.205971 0 0 0 33.352424-5.851302 63.194067 63.194067 0 0 0 26.272349-19.192272 51.84254 51.84254 0 0 0 11.117475-48.507298 49.092428 49.092428 0 0 0-34.347146-33.352425 130.015942 130.015942 0 0 0-23.40521-1.989443 269.393968 269.393968 0 0 0-23.40521-0.994721 8.016284 8.016284 0 0 0-5.090634 0.994721 11.702605 11.702605 0 0 0-0.994721 5.032121l-4.037399 47.454063c-0.643643 9.47911-1.696878 18.548629-3.042677 27.325583s-1.404313 19.309298-2.750112 30.075695zM504.520778 426.092434l-5.090633 38.384545-24.224393-4.037399-22.234949-1.989443a464.417881 464.417881 0 0 0-53.539418 0.994722 10.883423 10.883423 0 0 0-8.074798 3.042677l-8.074797 4.037399a10.590858 10.590858 0 0 0-5.032121 10.122753q0.994721 5.03212 8.074798 8.074798a133.292671 133.292671 0 0 0 17.436881 5.03212q8.074797 2.047956 17.20283 4.037399a239.903403 239.903403 0 0 0 23.40521 7.080076c7.372641 2.691599 14.452717 5.383198 21.181715 8.074797 20.88915 10.122753 30.660825 22.527515 29.256513 37.389823a50.847819 50.847819 0 0 1-24.224393 38.384545 109.536383 109.536383 0 0 1-27.676661 12.112196 206.492466 206.492466 0 0 1-29.256512 5.851302 287.181928 287.181928 0 0 1-101.988203-4.037398c-3.393755-1.3458-7.080076-2.691599-11.117475-4.037399q2.984164-20.186994 5.03212-36.336589c12.112196 1.3458 23.931827 3.042677 35.107815 5.032121l36.395102 4.037398a120.653858 120.653858 0 0 0 16.149595-0.994721c5.851303-1.3458 11.702605-2.340521 17.144316-3.042677a25.277627 25.277627 0 0 0 12.112197-5.851303A17.144316 17.144316 0 0 0 429.741132 544.171719c-0.643643-4.037399-4.388477-7.080076-11.117475-9.069519l-22.176437-5.090633c-5.851303-1.3458-12.814353-2.984164-20.245506-5.03212l-22.176437-7.957771a121.941144 121.941144 0 0 1-21.240228-10.122754 37.857927 37.857927 0 0 1-19.192272-29.256512q-0.994721-16.149595 16.149595-32.357703a72.205073 72.205073 0 0 1 26.272348-15.096361A124.047613 124.047613 0 0 1 386.207441 422.055036a337.035025 337.035025 0 0 1 113.105678 3.042677 17.904986 17.904986 0 0 1 5.207659 0.994721z m255.526381 2.047956a568.45404 568.45404 0 0 1 59.566259-9.069519 316.43844 316.43844 0 0 1 61.614216 2.223495q34.288633 5.090633 50.496741 25.277627t13.16543 54.53414q-1.989443 27.26707-4.037398 52.661722l-5.851303 51.549976h-54.534139l1.989442-29.256513q4.037399-36.336589 9.128032-72.73169 1.989443-25.219114-9.128032-33.293912a48.799863 48.799863 0 0 0-30.251234-9.128032h-16.208108a148.681597 148.681597 0 0 1-17.144316 1.053235 7.899258 7.899258 0 0 0-7.080076 2.984164 32.006625 32.006625 0 0 0-1.989443 5.851303l-14.160152 134.579958h-53.539418z m-480.801528 134.579958q-1.989443 18.197551-4.037399 35.107815a28.43733 28.43733 0 0 1-4.037399 3.042678 11.702605 11.702605 0 0 1-5.03212 0.994721 329.077254 329.077254 0 0 1-36.395101 2.047956q-19.133759 0.994721-36.336589 0.994721a161.964054 161.964054 0 0 1-59.56626-11.117474q-31.304468-13.165431-44.469899-35.107815a65.18351 65.18351 0 0 1-8.074797-50.496741 77.93935 77.93935 0 0 1 21.181715-40.432501 131.829846 131.829846 0 0 1 37.389823-27.267069 215.152394 215.152394 0 0 1 57.576817-18.197551 249.089948 249.089948 0 0 1 59.566259-2.984164 1023.977941 1023.977941 0 0 1 43.475178 5.03212l-5.090633 40.373987q-17.085803-0.936208-33.293911-2.984164-17.202829-1.053234-34.347146-1.053235a146.575128 146.575128 0 0 0-30.309747 3.042678 104.679802 104.679802 0 0 0-28.261791 12.112196 55.353322 55.353322 0 0 0-20.245507 27.26707 53.539418 53.539418 0 0 0 0 32.357703 36.863206 36.863206 0 0 0 12.170709 16.149594 49.209454 49.209454 0 0 0 18.139038 10.122754A124.047613 124.047613 0 0 0 216.519668 567.576929q19.192272 0 39.379266-1.989443c6.846024-0.760669 14.628256-1.755391 23.346697-3.10119z" fill="#FFFFFF" p-id="5104"></path></svg>'
      //   },
      //   link: 'https://blog.csdn.net/kjl536566?type=blog'
      // },
    ],
    search: {
      provider: 'local',
      options: {
        _render(src, env, md) {
          const html = md.render(src, env);
          if (env.frontmatter?.search === false) return '';
          if (env.relativePath.startsWith('docs/modules')) return '';
          return html;
        },
        locales: {
          root: {
            translations: {
              button: {
                buttonText: '搜索文档',
                buttonAriaLabel: '搜索文档~~'
              },
              modal: {
                noResultsText: '无法找到相关结果',
                resetButtonTitle: '清除查询条件',
                footer: {
                  selectText: '选择',
                  navigateText: '切换'
                }
              }
            }
          }
        }
      }
    }
  }
});
